package example.book.server;

import example.book.dao.BookDao;
import example.book.mapper.BookInfoMapper;
import example.book.mapper.UserInfoMapper;
import example.book.model.BookInfo;
import example.book.model.BookInfos;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BookServer {
    public List<BookInfo> getBookList() {
        BookDao bookDao = new BookDao();
        List<BookInfo> books = bookDao.mockData();
        for (BookInfo book : books) {
            if(book.getStatus() == 1) {
                book.setStatusCN("可借阅");
            }else {
                book.setStatusCN("不可借阅");
            }
        }
        return books;
    }
    @Autowired
    BookInfoMapper bookInfoMapper;
    public void addBook(BookInfos bookInfos) {
        bookInfoMapper.addBook(bookInfos);
    }
}
